﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using XRM.Security.DataAccess.Interfaces;

namespace XRM.Security.DataAccess.Models
{
    [Table("UserRegister")]
    public class UserRegister : IFio
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int UserRegisterId { get; set; }

        [Required]
        [MaxLength(50)]
        public string FirstName { get; set; }

        [Required]
        [MaxLength(50)]
        public string LastName { get; set; }

        [MaxLength(50)]
        public string MotherName { get; set; }

        [MaxLength(500)]
        public string Post { get; set; }

        public bool IsADUser { get; set; }
        
        [MaxLength(100)]
        public string Account { get; set; }

        public int? DepartmentId { get; set; }
        public int? DepartmentAddressId { get; set; }

        public int Status { get; set; }

        [ForeignKey("DepartmentId")]
        public virtual Department Department { get; set; }
        [ForeignKey("DepartmentAddressId")]
        public virtual DepartmentAddress DepartmentAddress { get; set; }

        public virtual ICollection<UserPC> PCs { get; set; }
        public virtual ICollection<UserInfoSystem> InfoSystems { get; set; }
        public virtual ICollection<UserSkzi> Skzis { get; set; }
        public virtual ICollection<RequestCert> RequestCerts { get; set; }
        public virtual ICollection<CertRegister> CertRegisters { get; set; }
        public virtual ICollection<Request> Requests { get; set; }
    } 
}
